using System;
using System.Collections.Generic;

namespace Shlick
{
	// For when you have multiple commands but want the command manager to treat them as one.
	// i.e. moving multiple objects by using multiple ObjectMoveCommands.
	public class CommandCollection : ICommand
	{
		public string Name { get; private set; }
		public List<ICommand> Commands { get; private set; }
	
		public CommandCollection (string name, List<ICommand> commands)
		{
			this.Commands = commands;
			this.Name = name;
		}
		
		public void Do ()
		{
			for (int i = 0; i < Commands.Count; i++)
				Commands[i].Do();
		}

		public void Undo ()
		{
			for (int i = Commands.Count - 1; i >= 0; i--)
				Commands[i].Undo();
		}
	}
}

